package render.graph
{
	import mx.core.UIComponent;
	
	public class Edge
	{
		public var fromNode:Node;
		public var toNode:Node;
		private var _isRel:Boolean;
		private var _text:String;
		private var _id:int;
		
		private var _display:UIComponent;
		
		private static var counter:int = 0;

		public function Edge(toNode:Node,fromNode:Node,isRel:Boolean,text:String)
		{
			this.fromNode = fromNode;
			this.toNode = toNode;
			_isRel=isRel;
			_text=text;
			counter = counter+1;
			_id = counter;
		}	
		public function length():Number
		{
			var result:int = fromNode.display.width + fromNode.display.height + toNode.display.width + toNode.display.height;
			result = result / 4;
			if(result > 0 )
				return result;
			return 50;
		}
		public function get isRel():Boolean
		{
			return _isRel;
		}
		public function get text():String
		{
			return _text;
		}
		public function get id():int
		{
			return _id;
		}
		public function get display():UIComponent
		{
			return _display;
		}
		public function set display(ui:UIComponent):void
		{
			_display = ui;
		}
	}
}